#include "AboutLayer.h"
#include "SysMenu.h"
AboutLayer::AboutLayer()
{}
bool AboutLayer::init() {
	if ( !CCLayer::init() )
	{
		return false;
	}
	//CCSize winSize = CCSizeMake(320,480);//winSize();
	/*CCSprite *sp = CCSprite::create("loading.png");
	sp->setAnchorPoint(ccp(0,0));
	addChild(sp, 0, 1);*/

	CCSprite *title = CCSprite::create("fengmian.png");
	title->setPosition(ccp(global_winSize.width / 2, 540));
	addChild(title);
    CCSize sz=CCSizeMake(380,300);
    CCTextAlignment t=kCCTextAlignmentCenter;
	CCLabelTTF * about = CCLabelTTF::create("Battle City game was remade.\n Powered by cocos2d-x.\n\n\nProgram: Ma Hongquan \nEmail: mahongquan@sina.com \nWeibo: weibo.com/mahongquan","Arial",16,sz,t);
	about->setPosition(ccp(210,240));
	addChild(about);
    /*
	CCLabelTTF *author = CCLabelTTF::labelWithString("Programmer:  Shengxiang Chen \n                         Dingping Lv \n\n Effects animation:  Hao Wu  \n\n Quality Assurance: Sean Lin",CCSizeMake(global_winSize.width * 0.85f ,150),CCTextAlignment::kCCTextAlignmentLeft,"Arial",14);
	author->setPosition(ccp(global_winSize.width/2,160));
	addChild(author);
     */
	/*CCLabelTTF* author2 = CCLabelTTF::labelWithString("Dingping Lv",CCSizeMake(global_winSize.width * 0.85f ,100),CCTextAlignmentCenter,"Arial",14);
	author2->setPosition(ccp(global_winSize.width/2,120));
	addChild(author2);

	CCLabelTTF* author3 = CCLabelTTF::labelWithString("Effects animation: \n Hao Wu",CCSizeMake(global_winSize.width * 0.85f ,100),CCTextAlignmentLeft,"Arial",14);
	author3->setPosition(ccp(global_winSize.width/2,100));
	addChild(author3);

	CCLabelTTF* author4 = CCLabelTTF::labelWithString("Quality Assurance: \n Sean Lin",CCSizeMake(global_winSize.width * 0.85f ,80),CCTextAlignmentLeft,"Arial",14);
	author4->setPosition(ccp(global_winSize.width/2,80));
	addChild(author4);*/

	CCLabelTTF *label= CCLabelTTF::create("Go back", "Arial", 30);
	label->setColor(ccc3(250,179,0));
	CCMenuItem* back = CCMenuItemLabel::create(label, this, menu_selector(AboutLayer::backCallback));
	CCMenu *menu = CCMenu::create(back,NULL);
	menu->setPosition(ccp(global_winSize.width/2,50));
	addChild(menu);
    return true;
}

void AboutLayer::backCallback(CCObject* pSender) {
	CCScene *scene = CCScene::create();
	scene->addChild(SysMenu::create());
	CCDirector::sharedDirector()->replaceScene(CCTransitionFade::create(1.2f, scene));
}

